package com.qiyu.tech.tcc.starter.dao;

import com.baomidou.mybatisplus.annotations.DataSource;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.qiyu.datasource.annotation.UsingDataSource;
import com.qiyu.tech.tcc.starter.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import static com.qiyu.datasource.enums.SupportDatasourceEnum.TEST_USER_DB;

/**
 * @author linhao
 * @date created in 8:17 下午 2020/11/3
 */
@Mapper
public interface UserDao extends BaseMapper<User> {

    @Update("update t_user set coupon_num=coupon_num+1 where user_id=#{userId}")
    int addCoupon(@Param(value = "userId") int userId);


    @Select("select * from t_user where user_id=#{userId}")
    User selectByUserId(@Param(value = "userId") int userId);
}
